﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Util
{
    public class Dates
    {
        public static int DIA = 0;

        public static int MES = 1;

        public static int ANIO = 2;
        
        public DateTime sumar(DateTime fecha, int value, int opcion)
        {

            DateTime aux = new DateTime();

            switch (opcion)
            {

                case 0:

                    aux = fecha.AddDays(value);

                    break;

                case 1:

                    aux = fecha.AddMonths(value);

                    break;

                case 2:

                    aux = fecha.AddYears(value);

                    break;

            }

            return aux;

        }



        public DateTime restar(DateTime fecha, int value, int opcion)
        {

            DateTime aux = new DateTime();

            switch (opcion)
            {

                case 0:

                    aux = fecha.AddDays(value * -1);

                    break;

                case 1:

                    aux = fecha.AddMonths(value * -1);

                    break;

                case 2:

                    aux = fecha.AddYears(value * -1);

                    break;

            }

            return aux;

        }

 
    }
}